﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class environnement
    {
        private static double[] enemylvltab = { 20, 40, 60, 80 };
        private static double[] fieldtab = { 2, 1, 0.5 };
        private static double[] lifetab = { 1.5, 1.25, 1 };
        private static Random R = new Random();

        public static result whathappened(dataset dset)
        {
            result r;
            double res = ((enemylvltab[(int)dset.Enemylevel] / ((double)dset.Allies + 1)) * fieldtab[(int)dset.Field]) / lifetab[(int)dset.Life];
            if (res > 99)
                res = 99;
            if ((R.Next() % 101) > res)
                r = result.good;
            else
                r = result.bad;
            return (r);
        }
    }
}
